<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="custom" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <title>案件详情</title>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=h0EKj4yWH81COWhXGS4G7uyi"></script>
    <script type="text/javascript" charset="utf-8" src="${contextPath}/resources/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${contextPath}/resources/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${contextPath}/resources/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>

<body>
<div class="pageheader">
    <div class="btn-group pull-right" role="group" style="margin-bottom: 0px;">
        <c:if test="${not info.status.finish and not info.status.cancelled and not info.status.pending}">
            <shiro:hasPermission name="CMC_CATEGORY:*">
                <button type="button" class="btn btn-primary loadModal"
                        url="change_category?uuid=${info.uuid}" data-toggle="modal"
                        data-target="#myModal">修改类别
                </button>
            </shiro:hasPermission>
            <shiro:hasPermission name="CMC_REPORT:*">
                <c:if test="${not info.disableStatus.report}">
                    <button type="button" class="btn btn-info loadModal"
                            url="report?uuid=${info.uuid}" data-toggle="modal"
                            data-target="#myModal">上报案件
                    </button>
                </c:if>
            </shiro:hasPermission>
            <shiro:hasPermission name="CMC_CANCEL:*">
                <button type="button" class="btn btn-warning loadModal"
                        url="cancel?uuid=${info.uuid}" data-toggle="modal"
                        data-target="#myModal">作废案件
                </button>
            </shiro:hasPermission>
            <shiro:hasPermission name="CMC_ASSIGNMENT:*">
                <c:if test="${sessionScope.employee.leader or not empty sessionScope.user}">
                    <button type="button" class="btn btn-darkblue loadModal"
                            url="assignment?caseUuid=${info.uuid}" data-toggle="modal"
                            data-target="#myModal">分派案件
                    </button>
                </c:if>
            </shiro:hasPermission>
            <shiro:hasPermission name="CMC_FINISH:*">
                <button type="button" class="btn btn-success loadModal"
                        url="finish?uuid=${info.uuid}" data-toggle="modal"
                        data-target="#myModal">完成案件
                </button>
            </shiro:hasPermission>
        </c:if>
        <shiro:hasPermission name="CMC_CASE_REVIEWED:*">
            <c:if test="${info.status.pending}">
                <button type="button" class="btn btn-success loadModal"
                        url="pending?uuid=${info.uuid}" data-toggle="modal"
                        data-target="#myModal">审核案件
                </button>
            </c:if>
        </shiro:hasPermission>
        <a href="javascript:window.history.go(-1);" class="btn btn-default pull-right">返回</a>
    </div>

    <h2>案件详情</h2>
</div>
<div class="contentpanel">

    <div class="panel">
        <form:form commandName="formDto" cssClass="form-horizontal form-bordered">
            <div class="panel panel-default">
                <div class="panel-body panel-body-nopadding">
                    <div class="form-group">
                        <div class="col-sm-12"><h4 class="panel-title">举报人信息</h4></div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-1 control-label">头像:</label>

                        <div class="col-sm-2">
                            <p class="form-control-static">
                                <img src="${info.creatorDto.headimgurl}" alt="头像" class="img-rounded"
                                     style="width: 30px;height: 30px;"/>
                            </p>
                        </div>
                        <label class="col-sm-1 control-label">昵称:</label>

                        <div class="col-sm-2">
                            <p class="form-control-static">
                                <span class="label label-primary">     ${info.creatorDto.nickname}
                                <c:if test="${not empty info.creatorDto.sex}"> (
                                    <c:if test="${info.creatorDto.sex =='1'}">男</c:if>
                                    <c:if test="${info.creatorDto.sex =='2'}">女</c:if>
                                    <c:if test="${info.creatorDto.sex =='0'}">未知</c:if>
                                    )</c:if>
                                </span>
                            </p>
                        </div>
                        <label class="col-sm-1 control-label">地址:</label>

                        <div class="col-sm-2">
                            <p class="form-control-static">
                                    ${info.creatorDto.country}${info.creatorDto.province}${info.creatorDto.city}
                            </p>
                        </div>
                        <label class="col-sm-1 control-label">电话:</label>

                        <div class="col-sm-2">
                            <p class="form-control-static">
                                    ${info.phone}
                            </p>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-12">
                            <h4 class="panel-title">案件信息</h4>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">案件类别:</label>

                        <div class="col-sm-3">
                            <p class="form-control-static">
                                <c:if test="${empty info.caseCategoryUuid}">
                                    <span class="label label-default category">未分类</span>
                                </c:if>
                                <c:if test="${not empty info.caseCategoryUuid}">
                                    <span class="label label-primary category"
                                          title="${info.categoryDto.name}">${info.categoryDto.shortName}</span>
                                </c:if>
                            </p>
                        </div>
                        <label class="col-sm-1 control-label">案件状态:</label>

                        <div class="col-sm-3">
                            <p class="form-control-static">
                                <c:if test="${info.status.noHandle}">
                                    <span class="label label-default">未处理</span>
                                </c:if>
                                <c:if test="${info.status.cancelled}">
                                    <span class="label label-danger">已作废</span>
                                </c:if>
                                <c:if test="${info.status.finish}">
                                    <span class="label label-success">已完成</span>
                                </c:if>
                                <c:if test="${info.status.report}">
                                    <span class="label label-primary">已上报</span>
                                </c:if>
                                <c:if test="${info.status.assignment}">
                                    <span class="label label-primary">已分派</span>
                                </c:if>
                                <c:if test="${info.status.pending}">
                                    <span class="label label-danger">待审核</span>
                                </c:if>
                                <c:if test="${info.status.lock}">
                                    <span class="label label-danger">${info.status.label}</span>
                                </c:if>
                            </p>
                        </div>
                        <label class="col-sm-1 control-label">处置人员:</label>

                        <div class="col-sm-3">
                            <p class="form-control-static">
                                <c:forEach items="${info.ownerList}" var="owner">
                                    <span class="label label-primary">${owner.name}(${owner.deptDto.name})</span>
                                </c:forEach>
                            </p>
                        </div>
                    </div>
                    <div class="form-group">
                        <ul class="nav nav-tabs">
                            <li class="active"><a data-toggle="tab" href="#all"><strong>案件图片</strong></a></li>
                            <li><a data-toggle="tab" href="#comments"><strong>案件留言</strong></a></li>
                            <li><a data-toggle="tab" href="#worklog"><strong>案件档案</strong></a></li>
                            <c:if test="${info.status.finish or info.status.pending}">
                                <li><a data-toggle="tab" href="#resultImage"><strong>案件处置结果</strong></a></li>
                            </c:if>
                        </ul>

                        <div class="tab-content noshadow">
                            <div id="all" class="tab-pane active">
                                <iframe src="images.htm?mini=true&uuid=${info.uuid}"
                                        style="border:none;width:100%;height:320px;"></iframe>
                            </div>
                            <div id="comments" class="tab-pane">
                                <iframe src="comments.htm?mini=true&uuid=${info.uuid}"
                                        style="border:none;width:100%;height:320px;"></iframe>
                                <br>
                            </div>
                            <div id="worklog" class="tab-pane">
                                <iframe src="records.htm?mini=true&uuid=${info.uuid}"
                                        style="border:none;width:100%;height:320px;"></iframe>
                            </div>
                            <c:if test="${info.status.finish or info.status.pending}">
                                <div id="resultImage" class="tab-pane">
                                    <iframe src="images.htm?mini=true&uuid=${info.uuid}&result=true"
                                            style="border:none;width:100%;height:320px;"></iframe>
                                </div>
                            </c:if>
                        </div>
                        <!-- tab-content -->
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">地址描述:</label>

                        <div class="col-sm-9">
                            <p class="form-control-static">
                                    ${info.addressDescription}
                            </p>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">定位地址:</label>

                        <div class="col-sm-11">
                            <c:if test="${not empty info.locationX}">
                                <div id="allmap" style="width:100%;height:400px;"></div>
                            </c:if>
                            <c:if test="${empty info.locationX}">
                                <p class="form-control-static"> 无经纬度信息 </p>
                            </c:if>
                        </div>
                    </div>

                </div>
            </div>
        </form:form>


    </div>
    <!-- row -->

</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>
<script type="text/javascript">
    $(function () {
        $("body").on("click", ".loadModal", function () {
            var url = $(this).attr("url");
            $(".modal-content").load(url);
        });
    })
</script>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    var point = new BMap.Point('${info.locationX}', '${info.locationY}');
    map.centerAndZoom(point, 15);

    var marker = new BMap.Marker(point); // 创建点

    var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
    var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
    map.addControl(top_left_control);
    map.addControl(top_left_navigation);
    map.addOverlay(marker);
</script>

</body>
</html>
